<template>
  <div id="app">
    <router-view class="children_view" />
  </div>
</template>
<script>
export default {
  mounted() {
    //在页面刷新时将vuex里的信息保存到localStorage里
    window.addEventListener("beforeunload", () => {
      localStorage.setItem("VUEXSTATE", JSON.stringify(this.$store.state));
    });

    //在页面加载时读取localStorage里的状态信息
    localStorage.getItem("VUEXSTATE") &&
      this.$store.replaceState(
        Object.assign(
          this.$store.state,
          JSON.parse(localStorage.getItem("VUEXSTATE"))
        )
      );
  },
};
</script>
<style lang="scss">
@import "./assets/css/reset.scss";
@import "./assets/css/all.scss";
@import "./assets/css/page.scss";
#app {
  width: 100vw;
  height: 100vh;


  .children_view {
    width: 100vw;
    height: 100vh;
    font-family: MicrosoftYaHei-Bold, PingFangSC-Semibold;
    font-size: 0.16rem;
    box-sizing: border-box;
  }
}
</style>
